//
//  PersonSingleTypeTableViewCell.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/8/1.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "PersonSingleTypeTableViewCell.h"
#import "PersonSingleTypeButton.h"

@implementation PersonSingleTypeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        NSArray *titles = @[@"待付款",@"待收货",@"已收货",@"退换货"];
        float btnW = ScreenW/4.0;
        for (int i=0; i<4; i++) {
            PersonSingleTypeButton *btn = [[PersonSingleTypeButton alloc]initWithFrame:CGRectMake(btnW*i, 0, btnW, 50)];
            [btn setTitle:titles[i] forState:UIControlStateNormal];
            [btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
            btn.titleLabel.font = Font(14);
            btn.titleLabel.textAlignment = NSTextAlignmentCenter;
            [btn setImage:GetImage(titles[i]) forState:UIControlStateNormal];
            btn.tag = i+1;
            [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
            [self addSubview:btn];
        }
    }
    return self;
}

- (void)btnClick:(UIButton *)btn
{
    if ([self.delegate respondsToSelector:@selector(personSingleTypeTableViewCellClick:)]) {
        [self.delegate personSingleTypeTableViewCellClick:(SingleType)btn.tag];
    }
}


@end
